package com.pzhu.record.service.impl;

import com.pzhu.record.constants.Constant;
import com.pzhu.record.entity.Punish;
import com.pzhu.record.service.PunishService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Zhou YuSen
 * @date 2020/4/13 9:20
 */
@Service(value = "punishService")
public class PunishServiceImpl extends BaseServiceImpl implements PunishService {
    @Override
    public int insert(Punish punish) {
        return 0;
    }

    @Override
    public int update(Punish punish) {
        return 0;
    }

    @Override
    public int delete(String id) {
        return 0;
    }

    @Override
    public int deleteAll(String[] pks) {
        return 0;
    }

    @Override
    public Punish selectById(String id) {
        return null;
    }

    @Override
    public List<Punish> selectAll() {
        return null;
    }

    @Override
    public int insertSelective(Punish punish) {
        String punishLevel = punish.getPunishLevel();
        if ("warn".equals(punishLevel)) {
            punish.setPunishLevel(Constant.PUNISHLEVEL_WARN);
        } else if ("seriousWarning".equals(punishLevel)) {
            punish.setPunishLevel(Constant.PUNISHLEVEL_SERIOUS_WARNING);
        } else if ("schoolWatch".equals(punishLevel)) {
            punish.setPunishLevel(Constant.PUNISHLEVEL_SCHOOL_WATCH);
        } else if ("expel".equals(punishLevel)) {
            punish.setPunishLevel(Constant.PUNISHLEVEL_EXPEL);
        }

        return punishMapper.insertSelective(punish);
    }
}
